-
Notifications
You must be signed in to change notification settings - Fork 95
feat: create @workflow/builders package with shared builder infrastructure #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 120a73d The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| import { mkdir, writeFile } from 'node:fs/promises'; | ||
| import { join, resolve } from 'node:path'; | ||
| import { BaseBuilder } from './base-builder.js'; | ||
| import { BaseBuilder } from '@workflow/builders'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be moving these builders over in future PRs
| @@ -1,6 +1,6 @@ | |||
| import { mkdir } from 'node:fs/promises'; | |||
| import { dirname, resolve } from 'node:path'; | |||
| import { BaseBuilder } from './base-builder.js'; | |||
| import { BaseBuilder } from '@workflow/builders'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be moving these builders over in future PRs
5dc881f to
ef1417a
Compare
f348c63 to
736b61a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Build Fix:
The index.ts file was importing constants from a non-existent constants.js file, causing TypeScript compilation to fail.
View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..32a74a6 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,3 @@ export { applySwcTransform } from './apply-swc-transform.js';
export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
Analysis
Missing constants.js file causes TypeScript compilation failure
What fails: TypeScript compiler fails on packages/builders/src/index.ts at line 11 due to missing constants.js file
How to reproduce:
cd packages/builders && pnpm run buildResult:
src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Build Fix:
The constants.ts file was missing but required by index.ts for exporting STEP_QUEUE_TRIGGER and WORKFLOW_QUEUE_TRIGGER constants.
View Details
📝 Patch Details
diff --git a/packages/builders/src/constants.ts b/packages/builders/src/constants.ts
new file mode 100644
index 0000000..97e01ae
--- /dev/null
+++ b/packages/builders/src/constants.ts
@@ -0,0 +1,2 @@
+export const STEP_QUEUE_TRIGGER = 'step' as const;
+export const WORKFLOW_QUEUE_TRIGGER = 'workflow' as const;
\ No newline at end of file
Analysis
Missing constants file causes TypeScript compilation failure
What fails: TypeScript compiler fails on packages/builders/src/index.ts line 11 due to missing constants module
How to reproduce:
cd packages/builders && pnpm run buildResult:
src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Build Fix:
The file imports constants from a non-existent ./constants.js module, causing TypeScript compilation to fail.
View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..396d2cd 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,4 @@ export { applySwcTransform } from './apply-swc-transform.js';
export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
+
Analysis
Missing constants.js module causes TypeScript compilation failure
What fails: TypeScript compiler fails on packages/builders/src/index.ts due to missing import of non-existent ./constants.js file
How to reproduce:
cd packages/builders && pnpm run buildResult:
src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Build Fix:
The file tried to import constants from a non-existent ./constants.js module, causing TypeScript compilation to fail. The unused export statement was removed since the constants weren't referenced anywhere in the codebase.
View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..396d2cd 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,4 @@ export { applySwcTransform } from './apply-swc-transform.js';
export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
+
Analysis
Missing constants file causes TypeScript compilation failure
What fails: TypeScript compiler fails on packages/builders/src/index.ts line 11 due to import from non-existent ./constants.js module
How to reproduce:
cd packages/builders && npx tscResult:
src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Build Fix:
The TypeScript compiler failed because line 11 attempts to import STEP_QUEUE_TRIGGER and WORKFLOW_QUEUE_TRIGGER from a non-existent constants.js file. This import was added during the builders package creation but the constants file was never created.
View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..396d2cd 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,4 @@ export { applySwcTransform } from './apply-swc-transform.js';
export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
+
Analysis
TypeScript compilation failure due to missing constants file
What fails: TypeScript compiler fails on packages/builders/src/index.ts line 11 due to import from non-existent './constants.js' file
How to reproduce:
cd packages/builders && pnpm run buildResult:
src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.736b61a to
738a512
Compare
f65ac77 to
256f736
Compare
packages/nitro/src/builders.ts
Outdated
| import { mkdir, readFile, writeFile } from 'node:fs/promises'; | ||
| import { BaseBuilder } from '@workflow/cli/dist/lib/builders/base-builder'; | ||
| import { VercelBuildOutputAPIBuilder } from '@workflow/cli/dist/lib/builders/vercel-build-output-api'; | ||
| import { join } from 'node:path'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Build Fix:
The file has duplicate join imports from both node:path and pathe packages, causing TypeScript compilation to fail with duplicate identifier errors.
View Details
📝 Patch Details
diff --git a/packages/nitro/src/builders.ts b/packages/nitro/src/builders.ts
index 42f2d2d..f054ce8 100644
--- a/packages/nitro/src/builders.ts
+++ b/packages/nitro/src/builders.ts
@@ -1,5 +1,4 @@
import { mkdir, readFile, writeFile } from 'node:fs/promises';
-import { join } from 'node:path';
import { BaseBuilder, VercelBuildOutputAPIBuilder } from '@workflow/builders';
import type { Nitro } from 'nitro/types';
import { join, resolve } from 'pathe';
Analysis
Duplicate identifier 'join' causes TypeScript compilation failure
What fails: TypeScript compiler fails on packages/nitro/src/builders.ts due to duplicate imports of join identifier
How to reproduce:
cd packages/nitro && pnpm run buildResult:
src/builders.ts(2,10): error TS2300: Duplicate identifier 'join'.
src/builders.ts(5,10): error TS2300: Duplicate identifier 'join'.The file had conflicting imports:
- Line 2:
import { join } from 'node:path'; - Line 5:
import { join, resolve } from 'pathe';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Build Fix:
The file imports join from both node:path and pathe libraries, creating a duplicate identifier error that prevents TypeScript compilation from succeeding.
View Details
📝 Patch Details
diff --git a/packages/nitro/src/builders.ts b/packages/nitro/src/builders.ts
index 42f2d2d..f054ce8 100644
--- a/packages/nitro/src/builders.ts
+++ b/packages/nitro/src/builders.ts
@@ -1,5 +1,4 @@
import { mkdir, readFile, writeFile } from 'node:fs/promises';
-import { join } from 'node:path';
import { BaseBuilder, VercelBuildOutputAPIBuilder } from '@workflow/builders';
import type { Nitro } from 'nitro/types';
import { join, resolve } from 'pathe';
Analysis
Duplicate identifier 'join' causes TypeScript compilation failure
What fails: TypeScript compiler fails on packages/nitro/src/builders.ts due to duplicate imports of join function from both node:path and pathe libraries
How to reproduce:
cd packages/nitro && pnpm run buildResult:
src/builders.ts(2,10): error TS2300: Duplicate identifier 'join'.
src/builders.ts(5,10): error TS2300: Duplicate identifier 'join'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Build Fix:
The file contains duplicate imports of the join function from both node:path and pathe, causing a TypeScript compilation error that prevents the build from completing.
View Details
📝 Patch Details
diff --git a/packages/nitro/src/builders.ts b/packages/nitro/src/builders.ts
index 42f2d2d..f054ce8 100644
--- a/packages/nitro/src/builders.ts
+++ b/packages/nitro/src/builders.ts
@@ -1,5 +1,4 @@
import { mkdir, readFile, writeFile } from 'node:fs/promises';
-import { join } from 'node:path';
import { BaseBuilder, VercelBuildOutputAPIBuilder } from '@workflow/builders';
import type { Nitro } from 'nitro/types';
import { join, resolve } from 'pathe';
Analysis
Duplicate import causes TypeScript compilation failure in @workflow/nitro
What fails: TypeScript compilation fails on packages/nitro/src/builders.ts due to duplicate identifier join
How to reproduce:
cd packages/nitro && pnpm buildResult:
src/builders.ts(2,10): error TS2300: Duplicate identifier 'join'.
src/builders.ts(5,10): error TS2300: Duplicate identifier 'join'.
ELIFECYCLE Command failed with exit code 2.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Build Fix:
The join function is imported twice, once from node:path and once from pathe, causing TypeScript to report a duplicate identifier error.
View Details
📝 Patch Details
diff --git a/packages/nitro/src/builders.ts b/packages/nitro/src/builders.ts
index 42f2d2d..f054ce8 100644
--- a/packages/nitro/src/builders.ts
+++ b/packages/nitro/src/builders.ts
@@ -1,5 +1,4 @@
import { mkdir, readFile, writeFile } from 'node:fs/promises';
-import { join } from 'node:path';
import { BaseBuilder, VercelBuildOutputAPIBuilder } from '@workflow/builders';
import type { Nitro } from 'nitro/types';
import { join, resolve } from 'pathe';
Analysis
Duplicate identifier 'join' causes TypeScript compilation failure
What fails: TypeScript compiler fails on packages/nitro/src/builders.ts due to duplicate imports of the join function
How to reproduce:
cd packages/nitro && pnpm run buildResult:
src/builders.ts(2,10): error TS2300: Duplicate identifier 'join'.
src/builders.ts(5,10): error TS2300: Duplicate identifier 'join'.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "dependencies": { | ||
| "@swc/core": "1.11.24", | ||
| "@workflow/cli": "workspace:*", | ||
| "@workflow/swc-plugin": "workspace:*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate dependency declaration: @workflow/swc-plugin is listed twice in the dependencies object (lines 30 and 33).
View Details
📝 Patch Details
diff --git a/packages/nitro/package.json b/packages/nitro/package.json
index 619d285..0b19a61 100644
--- a/packages/nitro/package.json
+++ b/packages/nitro/package.json
@@ -30,7 +30,6 @@
"@workflow/swc-plugin": "workspace:*",
"@workflow/builders": "workspace:*",
"@workflow/core": "workspace:*",
- "@workflow/swc-plugin": "workspace:*",
"exsolve": "^1.0.7",
"pathe": "^2.0.3"
},
Analysis
Duplicate dependency declaration in packages/nitro/package.json
What fails: The @workflow/swc-plugin dependency is declared twice in the dependencies object (lines 30 and 33), violating JSON semantics where duplicate keys result in undefined behavior.
How to reproduce:
# Parse and inspect the dependencies object
node -e "console.log(Object.keys(require('./packages/nitro/package.json').dependencies))"
# The duplicate key will appear only once due to silent overwritesResult: While the JSON parser silently keeps only the last occurrence, this is undefined behavior and violates best practices for configuration files. Most JSON tools and linters will flag this as an error.
Expected: Each dependency should be declared exactly once in the dependencies object per JSON specification and npm package.json conventions.
Fix: Removed the duplicate "@workflow/swc-plugin": "workspace:*" entry on line 33.
packages/nitro/src/builders.ts
Outdated
| import { mkdir, readFile, writeFile } from 'node:fs/promises'; | ||
| import { BaseBuilder } from '@workflow/cli/dist/lib/builders/base-builder'; | ||
| import { VercelBuildOutputAPIBuilder } from '@workflow/cli/dist/lib/builders/vercel-build-output-api'; | ||
| import { join } from 'node:path'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import { join } from 'node:path'; |
Duplicate join import: join is imported from both node:path (line 2) and pathe (line 5), with the second import shadowing the first.
View Details
Analysis
Duplicate join import causes TypeScript compilation error in builders.ts
What fails: packages/nitro/src/builders.ts imports join from both node:path (line 2) and pathe (line 5), causing TypeScript error TS2300: Duplicate identifier 'join'. The second import shadows the first, making the node:path import unused.
How to reproduce:
cd packages/nitro
npx tsc --noEmitResult: TypeScript reports:
src/builders.ts(2,10): error TS2300: Duplicate identifier 'join'.
src/builders.ts(5,10): error TS2300: Duplicate identifier 'join'.
Expected: TypeScript should compile without errors. The codebase intentionally uses pathe for path operations (it's declared as a dependency and also imported in packages/nitro/src/index.ts), so the unused node:path import should be removed.
Fix: Removed the duplicate import { join } from 'node:path'; from line 2, keeping only the import { join, resolve } from 'pathe'; import which is the intended import and is actually used throughout the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Build Fix:
The file contains duplicate imports of the join function from both 'node:path' and 'pathe' packages, causing a TypeScript compilation error.
View Details
📝 Patch Details
diff --git a/packages/nitro/src/builders.ts b/packages/nitro/src/builders.ts
index 42f2d2d..f054ce8 100644
--- a/packages/nitro/src/builders.ts
+++ b/packages/nitro/src/builders.ts
@@ -1,5 +1,4 @@
import { mkdir, readFile, writeFile } from 'node:fs/promises';
-import { join } from 'node:path';
import { BaseBuilder, VercelBuildOutputAPIBuilder } from '@workflow/builders';
import type { Nitro } from 'nitro/types';
import { join, resolve } from 'pathe';
Analysis
TypeScript build failure due to duplicate identifier 'join'
What fails: TypeScript compiler fails on packages/nitro/src/builders.ts due to duplicate import of identifier 'join'
How to reproduce:
pnpm --filter @workflow/nitro run buildResult:
src/builders.ts(2,10): error TS2300: Duplicate identifier 'join'.
src/builders.ts(5,10): error TS2300: Duplicate identifier 'join'.The file had duplicate imports:
- Line 2:
import { join } from 'node:path'; - Line 5:
import { join, resolve } from 'pathe';
…cture This commit extracts builder infrastructure from @workflow/cli into a new shared @workflow/builders package. This improves code organization by: - Creating a dedicated package for builder functionality - Allowing @workflow/next and @workflow/nitro to depend on builders directly - Reducing coupling between framework integrations and the CLI - Preparing for moving NextBuilder to @workflow/next in the next PR Changes: - Created new @workflow/builders package - Moved BaseBuilder, BasicBuilder, and VercelBuildOutputAPIBuilder - Moved esbuild plugins (swc, discover-entries, node-module) - Moved WorkflowConfig and BuildTarget types - Updated @workflow/cli to import from @workflow/builders - Updated @workflow/nitro to import from @workflow/builders - Re-exported types from CLI for backwards compatibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
256f736 to
a413ab6
Compare
Co-authored-by: Adrian <[email protected]>
a413ab6 to
120a73d
Compare

This commit extracts builder infrastructure from @workflow/cli into a new
shared @workflow/builders package. This improves code organization by:
Changes:
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]